package com.ruoyi.project.system.house.orientation.service.impl;

import javax.annotation.Resource;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.utils.uniquekey.IdGererateFactory;
import com.ruoyi.project.system.house.orientation.mapper.HouseOrientationMapper;
import com.ruoyi.project.system.house.orientation.domain.HouseOrientation;
import com.ruoyi.project.system.house.orientation.service.IHouseOrientationService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 房源朝向Service业务层处理
 * 
 * @author f_baisi
 * @date 2020-08-27
 */
@Service
public class HouseOrientationServiceImpl implements IHouseOrientationService 
{
    @Resource
    private IdGererateFactory idGererateFactory;
    @Autowired
    private HouseOrientationMapper houseOrientationMapper;

    /**
     * 查询房源朝向
     * 
     * @param id 房源朝向ID
     * @return 房源朝向
     */
    @Override
    public HouseOrientation selectHouseOrientationById(String id)
    {
        return houseOrientationMapper.selectHouseOrientationById(id);
    }

    /**
     * 查询房源朝向列表
     * 
     * @param houseOrientation 房源朝向
     * @return 房源朝向
     */
    @Override
    public List<HouseOrientation> selectHouseOrientationList(HouseOrientation houseOrientation)
    {
        return houseOrientationMapper.selectHouseOrientationList(houseOrientation);
    }

    /**
     * 新增房源朝向
     * 
     * @param houseOrientation 房源朝向
     * @return 结果
     */
    @Override
    public int insertHouseOrientation(HouseOrientation houseOrientation)
    {
        houseOrientation.setId(this.idGererateFactory.nextStringId());
        return houseOrientationMapper.insertHouseOrientation(houseOrientation);
    }

    /**
     * 修改房源朝向
     * 
     * @param houseOrientation 房源朝向
     * @return 结果
     */
    @Override
    public int updateHouseOrientation(HouseOrientation houseOrientation)
    {
        return houseOrientationMapper.updateHouseOrientation(houseOrientation);
    }

    /**
     * 删除房源朝向对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteHouseOrientationByIds(String ids)
    {
        return houseOrientationMapper.deleteHouseOrientationByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除房源朝向信息
     * 
     * @param id 房源朝向ID
     * @return 结果
     */
    @Override
    public int deleteHouseOrientationById(String id)
    {
        return houseOrientationMapper.deleteHouseOrientationById(id);
    }

    @Override
    public HouseOrientation findByName(String type) {
        return this.houseOrientationMapper.findByName(type);
    }
}
